package org.nightrunner.d3.entity;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "d3_guide_info", catalog = "d3")
public class GuideInfo implements java.io.Serializable {

	private static final long serialVersionUID = -6630443423016085161L;

	/**
	 * id
	 */
	private String id;

	/**
	 * ip地址
	 */
	private String ip;

	/**
	 * 时间
	 */
	private Date time = new Date();

	/**
	 * userAgent
	 */
	private String userAgent;

	@Column(name = "user_agent", length = 512)
	public String getUserAgent() {
		return userAgent;
	}

	@Id
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
	@Column(name = "id", length = 32)
	public String getId() {
		return id;
	}

	@Column(name = "ip", length = 128)
	public String getIp() {
		return ip;
	}

	@Column(name = "time")
	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	public void setId(String id) {
		this.id = id;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public void setUserAgent(String userAgent) {
		this.userAgent = userAgent;
	}

	public String toString() {

		return new StringBuffer().append(ip).append(",").append(
				new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(time))
				.append(",").append(userAgent).toString();
	}

}
